package org.webscale.util.file;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class SummaryStats implements Serializable{

	Calendar startTime;
	Calendar endTime;
	
	int rowsRead;
	int rowsProcessed;
	int rowsRejected;
	int filterCount ;
	
	public SummaryStats(){
		super();
		startTime = Calendar.getInstance();
	}
	
	public int getProcessingTimeInSeconds(){
		return 0;
	}
	
	public Calendar getStartTime() {
		return startTime;
	}
	public void setStartTime(Calendar startTime) {
		this.startTime = startTime;
	}
	public Calendar getEndTime() {
		return endTime;
	}
	public void setEndTime(Calendar endTime) {
		this.endTime = endTime;
	}
	public int getRowsRead() {
		return rowsRead;
	}
	public void setRowsRead(int rowsRead) {
		this.rowsRead = rowsRead;
	}
	public int getRowsProcessed() {
		return rowsProcessed;
	}
	public void setRowsProcessed(int rowsProcessed) {
		this.rowsProcessed = rowsProcessed;
	}
	public int getRowsRejected() {
		return rowsRejected;
	}
	public void setRowsRejected(int rowsRejected) {
		this.rowsRejected = rowsRejected;
	}
	
	public String getTotalTime(){
		Date s1 = startTime.getTime();
		Date s2 = endTime.getTime();
		long diff = s2.getTime() - s1.getTime();
		long seconds =  diff / 1000;
		long minutes = seconds / 60;
		return "Seconds=" + seconds + " ; Minutes=" + minutes;
	}
	
	public String toString(){
		ToStringBuilder builder = new ToStringBuilder(this ,ToStringStyle.MULTI_LINE_STYLE);
		//builder.append("startTime" , startTime);
		//builder.append("endTime" , startTime);
		builder.append("rowsRead" , rowsRead);
		builder.append("rowsProcessed" , rowsProcessed);
		builder.append("rowsFiltered" , filterCount);
		builder.append("rowsRejected" , rowsRejected);
		return builder.toString();
	//	return ToStringBuilder.reflectionToString(this ,ToStringStyle.MULTI_LINE_STYLE);
		
		
	}

	public void setFilterCount(int filterCount) {
		this.filterCount = filterCount;
		
	}
	
}
